#include <iostream>
#include <vector>
#include <string>

using namespace std;

int solution(int n, int k) {
    // write code here
    if (n == 0)
        return 0;
    vector<int> vc;
    for (int i = 1; vc.size() != n; i++)
    {
        if (i % k == 0)
            vc.push_back(i);
    }
    int ans = 0;
    for (auto val : vc)
    {
        ans += val;
    }
    return ans;
}

//int main() {
//    std::cout << (solution(3, 1) == 6) << std::endl;
//    std::cout << (solution(2, 2) == 6) << std::endl;
//    std::cout << (solution(4, 3) == 30) << std::endl;
//}